import { defineStore } from "pinia";

export const useStore = defineStore('precharge',{
    state: () => {
        return {
            userinfo:{
                cardNumber: '',
                userName: '',
                phoneNumber: '',
                balance: 0,
            },
            adminName: '',
        }
    },

    getters: {
        getUserInfo() {
            return this.userinfo
        },
        getAdminName() {
            return this.adminName
        }
    },

    actions: {
        setUserInfo(res) {
            this.userinfo = res
        },
        resetUserInfo() {
            this.userinfo = {
                cardNumber: '',
                userName: '',
                phoneNumber: '',
                balance: 0,
            }
        },
        setAdminName(res) {
            this.adminName = res
        },
    }
})

